package com.nowcoder.community;

import com.nowcoder.community.dao.LoginTicketMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.sql.Date;

/**
 * @BelongsProject: community
 * @BelongsPackage: com.nowcoder.community
 * @Author: Master_XXJS
 * @CreateTime: 2022-09-23  10:18
 * @Description: TODO
 * @Version: 1.0
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class LoginTicket {

    @Autowired
    LoginTicketMapper loginTicketMapper;

    @Test
    public void insert(){
        com.nowcoder.community.entity.LoginTicket loginTicket = new com.nowcoder.community.entity.LoginTicket();

        loginTicket.setTicket("xxjs");
        loginTicket.setStatus(0);
        loginTicket.setExpired(new Date(System.currentTimeMillis()));
        loginTicket.setUserId(168);

        loginTicketMapper.insertLoginTicket(loginTicket);
    }

    @Test
    public void selectByTicketTest(){
        com.nowcoder.community.entity.LoginTicket xxjs = loginTicketMapper.selectByTicket("xxjs");
        System.out.println(xxjs);

        loginTicketMapper.updateStatus("xxjs",1);
    }
}

